<template>
  <el-dialog :title="title"  center :visible.sync="open" v-if="open" width="1024px" append-to-body :close-on-click-modal="false">
    <el-form ref="detailForm" :model="detailForm" :rules="rules" label-width="140px">
      <el-card class="form-card payerInfo-card">
        <div slot="header" class="label-header-msg">
          <span>基本信息</span>
        </div>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="交易流水号" prop="id">
              <el-input v-model="detailForm.id" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="CPG日期" prop="vdate">
              <el-date-picker
                v-model="detailForm.vdate"
                style="width: 100%"
                type="date"
                value-format="yyyyMMdd"
                :disabled="true"
              />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="工作日期" prop="workdate">
              <el-date-picker
                v-model="detailForm.workdate"
                style="width: 100%"
                type="date"
                value-format="yyyyMMdd"
                :disabled="true"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="业务类型" prop="bizTypeCode">
              <el-select
                style="width: 100%"
                v-model="
                  detailForm.bizTypeCode === null || detailForm.bizTypeCode === undefined
                    ? ''
                    : detailForm.bizTypeCode + '-' + detailForm.bizTypeCodeDesc
                "
                placeholder="业务类型"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="业务种类" prop="bizCtgyCode">
              <el-select
                style="width: 100%"
                v-model="
                  detailForm.bizCtgyCode === null || detailForm.bizCtgyCode === undefined
                    ? ''
                    : detailForm.bizCtgyCode + '-' + detailForm.bizCtgyCodeDesc
                "
                placeholder="业务种类"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
      <el-card class="form-card payerInfo-card">
        <div slot="header" class="label-header-msg">
          <span>收款人信息</span>
        </div>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="收款人账号" prop="payeeActno">
              <el-input v-model="detailForm.payeeActno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="收款人名称" prop="payeeName">
              <el-input v-model="detailForm.payeeName" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="收款行行号" prop="payeeBrno">
              <el-input v-model="detailForm.payeeBrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="收款行行名" prop="payeeBrname">
              <el-input v-model="detailForm.payeeBrname" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="收款人开户行行号" prop="payeeAccBrno">
              <el-input v-model="detailForm.payeeAccBrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="收款人开户行行名" prop="payeeAccBrname">
              <el-input v-model="detailForm.payeeAccBrname" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
      <el-card class="form-card payerInfo-card">
        <div slot="header" class="label-header-msg">
          <span>付款人信息</span>
        </div>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="付款人账号" prop="payerActno">
              <el-input v-model="detailForm.payerActno" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款人名称" prop="payerName">
              <el-input v-model="detailForm.payerName" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="付款行行号" prop="payerBrno">
              <el-input v-model="detailForm.payerBrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="付款行行名" prop="payerBrname">
              <el-input v-model="detailForm.payerBrname" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="付款人开户行行号" prop="payerAccBrno">
              <el-input v-model="detailForm.payerAccBrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="付款人开户行名称" prop="payerAccBrname">
              <el-input v-model="detailForm.payerAccBrname" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>

      <div v-if="this.detailForm.bizTypeCode === 'B104'">
        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>国库资金借记划拨附加数据</span>
          </div>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="信息流水号" prop="flowNb">
                <el-input v-model="detailForm.flowNb" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="报表日期" prop="reportDate">
                <el-date-picker
                  v-model="detailForm.reportDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="报表序号" prop="reportNumber">
                <el-input v-model="detailForm.reportNumber" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="上报国库代码" prop="reportCode">
                <el-input v-model="detailForm.reportCode" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="接收国库代码" prop="receiveCode">
                <el-input v-model="detailForm.receiveCode" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="预算级次" prop="budgetLevel">
                <el-select style="width: 100%" v-model="detailForm.budgetLevel" placeholder="预算级次" :disabled="true">
                  <el-option
                    v-for="dict in dictMap.BUDGETLEVELCODE"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="调整期标志" prop="indicatorCode">
                <el-select
                  style="width: 100%"
                  v-model="detailForm.indicatorCode"
                  placeholder="调整期标志"
                  :disabled="true"
                >
                  <el-option
                    v-for="dict in dictMap.INDICATOR_CODE"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="预算种类" prop="budgetType">
                <el-select style="width: 100%" v-model="detailForm.budgetType" placeholder="预算种类" :disabled="true">
                  <el-option
                    v-for="dict in dictMap.BUDGETTYPECODE"
                    :key="dict.value"
                    :label="`${dict.value}-${dict.text}`"
                    :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="明细条数" prop="dtlCount">
                <el-input v-model="detailForm.dtlCount" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="明细汇总金额" prop="dtlAmount">
                <ht-amount-input
                  v-model="detailForm.dtlAmount"
                  placeholder="明细汇总金额"
                  :disable="true"
                ></ht-amount-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <ht-table
              ref="dataTableB104"
              :multi-select="false"
              :showSerialNumber="false"
              :dictMap="dictMap"
              :queryParams="{ id: this.detailForm.oriId }"
              :tableBindColumns="tableBindColumnsB104"
              :reqConfig="regConfigB104"
              :showRightToolbar="false"
            >
              <template v-slot:operate>
                <el-table-column label="操作" align="left" width="50" fixed="right">
                  <template slot-scope="scope">
                    <ht-button-group
                      :buttonList="[
                        {
                          label: '明细',
                          doFunc: () => {
                            openB104(scope.row);
                          },
                        },
                      ]"
                    />
                  </template>
                </el-table-column>
              </template>
            </ht-table>
          </el-row>
        </el-card>
      </div>

      <div v-if="this.detailForm.bizTypeCode === 'B307'">
        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>国库资金国债兑付借记划拨附加数据</span>
          </div>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="信息流水号" prop="flowNb">
                <el-input v-model="detailForm.flowNb" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="报表日期" prop="reportDate">
                <el-date-picker
                  v-model="detailForm.reportDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="报表序号" prop="reportNumber">
                <el-input v-model="detailForm.reportNumber" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="上报国库代码" prop="reportCode">
                <el-input v-model="detailForm.reportCode" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="接收国库代码" prop="receiveCode">
                <el-input v-model="detailForm.receiveCode" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="明细条数" prop="dtlCount">
                <el-input v-model="detailForm.dtlCount" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="明细汇总金额" prop="dtlAmount">
                <ht-amount-input
                  v-model="detailForm.dtlAmount"
                  placeholder="明细汇总金额"
                  :disable="true"
                ></ht-amount-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <ht-table
              ref="dataTableB307"
              :multi-select="false"
              :showSerialNumber="false"
              :dictMap="dictMap"
              :queryParams="{ id: this.detailForm.oriId }"
              :tableBindColumns="tableBindColumnsB307"
              :reqConfig="regConfigB307"
              :showRightToolbar="false"
            >
              <template v-slot:operate>
                <el-table-column label="操作" align="left" width="50" fixed="right">
                  <template slot-scope="scope">
                    <ht-button-group
                      :buttonList="[
                        {
                          label: '明细',
                          doFunc: () => {
                            openB307(scope.row);
                          },
                        },
                      ]"
                    />
                  </template>
                </el-table-column>
              </template>
            </ht-table>
          </el-row>
        </el-card>
      </div>

      <div v-if="this.detailForm.bizTypeCode === 'B308'">
        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>小额支付系统支票截留业务附加数据</span>
          </div>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="出票日期" prop="issueDate">
                <el-date-picker
                  v-model="detailForm.issueDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="提示付款日期" prop="payDate">
                <el-date-picker
                  v-model="detailForm.payDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="票据号码" prop="noteNumber">
                <el-input v-model="detailForm.noteNumber" :disabled="true" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="支付密码" prop="payPassword">
                <el-input v-model="detailForm.payPassword" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="用途" prop="use">
                <el-input v-model="detailForm.use" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="票据正面图像路径" prop="imgFrnData">
                <el-input type="textarea" v-model="detailForm.imgFrnFileName" :disabled="true" />
                <el-button type="primary" v-show="detailForm.imgFrnDownload!==undefined&&detailForm.imgFrnDownload!==null"
                           icon="el-icon-search" plain @click="downloadFile(detailForm.imgFrnDownload)">
                  下载
                </el-button>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="票据背面图像路径" prop="imgBckData">
                <el-input type="textarea" v-model="detailForm.imgBckFileName" :disabled="true" />
                <el-button type="primary" v-show="detailForm.imgBckDownload!==undefined&&detailForm.imgBckDownload!==null"
                           icon="el-icon-search" plain @click="downloadFile(detailForm.imgBckDownload)">
                  下载
                </el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-card>
      </div>

      <div
        v-if="
          this.detailForm.bizTypeCode === 'B309' ||
          this.detailForm.bizTypeCode === 'B310' ||
          this.detailForm.bizTypeCode === 'B311'
        "
      >
        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>小额支付系统通用票据截留业务附加数据</span>
          </div>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="出票日期" prop="issueDate">
                <el-date-picker
                  v-model="detailForm.issueDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="出票货币币种" prop="issueCurrcd">
                <el-input v-model="detailForm.issueCurrcd" :disabled="true" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="出票金额" prop="issueAmount">
                <ht-amount-input
                  v-model="detailForm.issueAmount"
                  placeholder="出票金额"
                  :disable="true"
                ></ht-amount-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="提示付款日期" prop="payDate">
                <el-date-picker
                  v-model="detailForm.payDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="票据到期日期" prop="draftMaturity">
                <el-date-picker
                  v-model="detailForm.draftMaturity"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="票据号码" prop="noteNumber">
                <el-input v-model="detailForm.noteNumber" :disabled="true" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="支付密码" prop="payPassword">
                <el-input v-model="detailForm.payPassword" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="票据密押" prop="draftKey">
                <el-input v-model="detailForm.draftKey" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="承兑协议编号" prop="protoNo">
                <el-input v-model="detailForm.protoNo" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="承兑日期" prop="acceptDate">
                <el-date-picker
                  v-model="detailForm.acceptDate"
                  style="width: 100%"
                  type="date"
                  value-format="yyyyMMdd"
                  :disabled="true"
                />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="承兑人" prop="acceptor">
                <el-input v-model="detailForm.acceptor" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="申请人账号" prop="applyAccount">
                <el-input v-model="detailForm.applyAccount" :disabled="true" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="申请人名称" prop="applyName">
                <el-input v-model="detailForm.applyName" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="出票人账号" prop="issueAccount">
                <el-input v-model="detailForm.issueAccount" :disabled="true" />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="出票人全称" prop="issueName">
                <el-input v-model="detailForm.issueName" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="交易合同号码" prop="pactNumber">
                <el-input v-model="detailForm.pactNumber" :disabled="true" />
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="用途" prop="use">
                <el-input v-model="detailForm.use" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="原收款人名称" prop="oriPayeeName">
                <el-input v-model="detailForm.oriPayeeName" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="票据正面图像路径" prop="imgFrnData">
                <el-input type="textarea" v-model="detailForm.imgFrnFileName" :disabled="true" />
                <el-button type="primary" v-show="detailForm.imgFrnDownload!==undefined&&detailForm.imgFrnDownload!==null"
                           icon="el-icon-search" plain @click="downloadFile(detailForm.imgFrnDownload)">
                  下载
                </el-button>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-col :span="24">
              <el-form-item label="票据背面图像路径" prop="imgBckData">
                <el-input type="textarea" v-model="detailForm.imgBckFileName" :disabled="true" />
                <el-button type="primary" v-show="detailForm.imgBckDownload!==undefined&&detailForm.imgBckDownload!==null"
                           icon="el-icon-search" plain @click="downloadFile(detailForm.imgBckDownload)">
                  下载
                </el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-card>

        <el-card class="form-card txnInfo-card">
          <div slot="header" class="label-header-msg">
            <span>被背书人清单</span>
          </div>
          <el-row type="flex">
            <el-col :span="12">
              <el-form-item label="被背书人数" prop="endorserNumber">
                <el-input v-model="detailForm.endorserNumber" :disabled="true" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row type="flex">
            <el-row type="flex">
              <ht-table
                ref="dataTableB309"
                :multi-select="false"
                :showSerialNumber="false"
                :dictMap="dictMap"
                :queryParams="{ id: this.detailForm.oriId }"
                :tableBindColumns="tableBindColumnsB309"
                :reqConfig="regConfigB309"
                :showRightToolbar="false"
              />
            </el-row>
          </el-row>
        </el-card>
      </div>
      <el-card class="form-card payerInfo-card">
        <div slot="header" class="label-header-msg">
          <span>其他交易信息</span>
        </div>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="货币种类" prop="curcd">
              <el-input v-model="detailForm.curcd" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="金额" prop="amount">
              <ht-amount-input v-model="detailForm.amount" placeholder="金额" :disable="true"></ht-amount-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="回执期限" prop="pkgRtrltd">
              <el-input v-model="detailForm.pkgRtrltd" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="地域标识" prop="regionid">
              <el-select style="width: 100%" v-model="detailForm.regionid" placeholder="地域标识" :disabled="true">
                <el-option
                  v-for="dict in dictMap.RegionId"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="24">
            <el-form-item label="附言" prop="content">
              <el-input type="textarea" v-model="detailForm.content" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="代理行手续费币种" prop="proxyCurcd">
              <el-input v-model="detailForm.proxyCurcd" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="代理行手续费" prop="proxyFee">
              <ht-amount-input
                v-model="detailForm.proxyFee"
                placeholder="代理行手续费"
                :disable="true"
              ></ht-amount-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="业务回执状态" prop="bizRtStatus">
              <el-select
                style="width: 100%"
                v-model="detailForm.bizRtStatus"
                placeholder="业务回执状态"
                :disabled="true"
              >
                <el-option
                  v-for="dict in dictMap.PROCESSSTATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="业务拒绝处理码" prop="rejectCode">
              <el-select
                style="width: 100%"
                v-model="
                  detailForm.rejectCode === null || detailForm.rejectCode === undefined
                    ? ''
                    : detailForm.rejectCode + '-' + detailForm.rejectCodeDesc
                "
                placeholder="原业务类型"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="24">
            <el-form-item label="业务拒绝原因" prop="rejectContent">
              <el-input type="textarea" v-model="detailForm.rejectContent" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="录入操作员" prop="mdTlrno">
              <el-input v-model="detailForm.mdTlrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="录入时间" prop="mdTime">
              <el-date-picker
                style="width: 100%"
                v-model="detailForm.mdTime"
                value-format="yyyyMMddHHmmss"
                type="datetime"
                :disabled="true"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="24">
            <el-form-item label="审核附言" prop="audRemarks">
              <el-input type="textarea" v-model="detailForm.audRemarks" maxlength="128" show-word-limit />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
    </el-form>
    <div slot="footer" class="dialog-footer" align="center">
      <el-button type="primary" @click="approve" v-loading.fullscreen.lock="loading">审 核</el-button>
      <el-button type="primary" @click="reject" v-loading.fullscreen.lock="loading">拒 绝</el-button>
      <el-button type="primary" @click="cancel">关 闭</el-button>
    </div>

    <beps-debit-receipt-audit-approve-detail-b104
      ref="bepsDebitReceiptAuditApproveDetailB104Dialog"
      :dictMap="dictMapAsc"
      :detailForm.sync="b104detailForm"
      @editComplete="editComplete"
    ></beps-debit-receipt-audit-approve-detail-b104>

    <beps-debit-receipt-audit-approve-detail-b307
      ref="bepsDebitReceiptAuditApproveDetailB307Dialog"
      :dictMap="dictMapAsc"
      :detailForm.sync="b307detailForm"
      @editComplete="editComplete"
    ></beps-debit-receipt-audit-approve-detail-b307>
  </el-dialog>
</template>
<script>
import HtAmountInput from "@/views/components/HtAmountInput";
import { amountThousandsFormatter } from "@/utils/table_col_formatter";
import { listPageMixin } from "@/libs/listPageMixin";
import {
  bepsDebitReceiptAuditApproveApprove5014,
  bepsDebitReceiptAuditApproveB104Query,
  bepsDebitReceiptAuditApproveB307Query,
  bepsDebitReceiptAuditApproveB309Query,
  bepsDebitReceiptAuditApproveReject5014,
} from "@/api/cnaps/beps/baseHandWork/bepsDebitReceiptAuditApprove";
import BepsDebitReceiptAuditApproveDetailB104 from "@/views/cnaps/beps/baseHandWork/components/beps_debit_receipt_audit_approve_detailB104";
import BepsDebitReceiptAuditApproveDetailB307 from "@/views/cnaps/beps/baseHandWork/components/beps_debit_receipt_audit_approve_detailB307";
import { baseUrlConfig, downloadfile } from "@/api/authority_app/base";

export default {
  name: "BepsDebitReceiptAuditApproveDetail5014",
  mixins: [listPageMixin],
  components: { BepsDebitReceiptAuditApproveDetailB104, BepsDebitReceiptAuditApproveDetailB307, HtAmountInput },
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    detailForm: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      // 是否显示弹出层
      open: false,
      loading: false,
      title: "小额借记来账手工处理审核明细",
      rules: {},

      b104detailForm: {},
      b307detailForm: {},

      dictMapAsc: this.dictMap,

      regConfigB104: bepsDebitReceiptAuditApproveB104Query,
      regConfigB307: bepsDebitReceiptAuditApproveB307Query,
      regConfigB309: bepsDebitReceiptAuditApproveB309Query,
      tableBindColumnsB104: [
        { prop: "deptCode", label: "征收机关大类代码", dictCode: "DEPT_CODE" },
        { prop: "subjectCode", label: "预算科目代码" },
        { prop: "curcd", label: "发生额币种" },
        { prop: "amount", label: "发生额", type: "price" },
      ],
      tableBindColumnsB307: [
        { prop: "debtBankType", label: "兑付国债银行大类", dictCode: "DEBT_BANK_TYPE" },
        { prop: "capitalCode", label: "本金代码" },
        { prop: "capitalCurcd", label: "本金金额币种", dictCode: "CURCD" },
        { prop: "capitalAmount", label: "本金金额", type: "price" },
        { prop: "accrualCode", label: "利息代码" },
        { prop: "accrualCurcd", label: "利息金额币种", dictCode: "CURCD" },
        { prop: "accrualAmount", label: "利息金额", type: "price" },
      ],
      tableBindColumnsB309: [{ prop: "endorserName", label: "被背书人名称" }],
    };
  },
  mounted() {},
  methods: {
    show() {
      this.open = true;
      if (this.detailForm.imgFrnData !== undefined) {
        let imgFrnFileName = this.detailForm.imgFrnData.split("||");
        if (imgFrnFileName.length > 1) {
          this.$set(this.detailForm, "imgFrnFileName", imgFrnFileName[1]);
          this.$set(this.detailForm, "imgFrnDownload", this.detailForm.imgFrnData);
        }
      }
      if (this.detailForm.imgBckData !== undefined) {
        let imgBckFileName = this.detailForm.imgBckData.split("||");
        if (imgBckFileName.length > 1) {
          this.$set(this.detailForm, "imgBckFileName", imgBckFileName[1]);
          this.$set(this.detailForm, "imgBckDownload", this.detailForm.imgBckData);
        }
      }

    },

    cancel() {
      this.open = false;
    },

    openB104(row) {
      this.b104detailForm = row;
      this.$refs.bepsDebitReceiptAuditApproveDetailB104Dialog.show();
    },

    openB307(row) {
      this.b307detailForm = row;
      this.$refs.bepsDebitReceiptAuditApproveDetailB307Dialog.show();
    },

    approve: function () {
      this.$refs["detailForm"].validate((valid) => {
        if (valid) {
          this.loading = true;
          bepsDebitReceiptAuditApproveApprove5014(this.detailForm)
            .then((response) => {
              this.msgSuccess("审核成功");
              this.open = false;
              this.$nextTick(() => {
                this.$parent.$refs.dataTable.doQuery(true);
              });
              this.loading = false;
            })
            .catch((err) => {
              this.loading = false;
            });
        }
      });
    },

    reject: function () {
      this.$refs["detailForm"].validate((valid) => {
        if (valid) {
          this.loading = true;
          bepsDebitReceiptAuditApproveReject5014(this.detailForm)
            .then((response) => {
              this.msgSuccess("拒绝成功");
              this.open = false;
              this.$nextTick(() => {
                this.$parent.$refs.dataTable.doQuery(true);
              });
              this.loading = false;
            })
            .catch((err) => {
              this.loading = false;
            });
        }
      });
    },

    downloadFile(fileId) {
      if (fileId !== undefined && fileId !== "") {
        downloadfile(`${baseUrlConfig.downloadFile}`, fileId).then((response) => {
          let blob = new Blob([response.data], { type: "image/jpeg" });
          console.log(response);
          let objectUrl = URL.createObjectURL(blob);
          const link = document.createElement("a"); // 创建a标签
          link.href = objectUrl;
          // const fileNameSplit = response.headers['content-disposition'].split('=')
          // const fileName = decodeURI(fileNameSplit[fileNameSplit.length - 1]) // 跟后端约定好最后一个值为fileName字段
          link.download = fileId.split("||")[1]; // 自定义文件名

          link.click(); // 下载文件
          URL.revokeObjectURL(objectUrl); // 释放内存
        });
      } else {
        this.msgError("下载文件不存在");
      }
    },

  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
